package com.ktjy.ch05.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.util.Date;
import java.util.Objects;

/**
 * @return 13141
 * 2025/7/14
 * 17:26
 */
@Data
@TableName("sys_right")
public class Right {
    @TableId
    @TableField("right_code")
    private String rightCode;  // 编号
    @TableField("right_parent_code")
    private String rightParentCode;  // 父级编号
    @TableField("right_type")
    private String rightType;  // 类型
    @TableField("right_text")
    private String rightText;  // 名称
    @TableField("right_url")
    private String rightUrl;  // url地址
    @TableField("right_tip")
    private String rightTip;  // 说明
    @Version
    private Integer version;  // 版本
    private Boolean deleted;  // 逻辑删除
    // createTime 和 updateTime 字段将由 MyBatis-Plus 自动填充
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    // 构造函数
    public Right() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Right right = (Right) o;
        // 使用id或name字段来判断是否相等
        return Objects.equals(rightCode, right.rightCode);  // 或者 Objects.equals(name, right.name)
    }

    @Override
    public int hashCode() {
        // 使用与equals方法中相同的字段来生成hashCode
        return Objects.hash(rightCode);  // 或者 name
    }


    public Right(String rightCode, String rightParentCode, String rightType, String rightText, String rightUrl, String rightTip) {
        this.rightCode = rightCode;
        this.rightParentCode = rightParentCode;
        this.rightType = rightType;
        this.rightText = rightText;
        this.rightUrl = rightUrl;
        this.rightTip = rightTip;
    }

    public Right(String rightParentCode, String rightType, String rightText, String rightUrl, String rightTip) {
        this.rightParentCode = rightParentCode;
        this.rightType = rightType;
        this.rightText = rightText;
        this.rightUrl = rightUrl;
        this.rightTip = rightTip;
    }

    // 属性封装
    public String getRightCode() {
        return rightCode;
    }

    public void setRightCode(String rightCode) {
        this.rightCode = rightCode;
    }

    public String getRightParentCode() {
        return rightParentCode;
    }

    public void setRightParentCode(String rightParentCode) {
        this.rightParentCode = rightParentCode;

    }

    public String getRightType() {
        return rightType;
    }

    public void setRightType(String rightType) {
        this.rightType = rightType;
    }

    public String getRightText() {
        return rightText;
    }

    public void setRightText(String rightText) {
        this.rightText = rightText;
    }

    public String getRightUrl() {
        return rightUrl;
    }

    public void setRightUrl(String rightUrl) {
        this.rightUrl = rightUrl;
    }

    public String getRightTip() {
        return rightTip;
    }

    public void setRightTip(String rightTip) {
        this.rightTip = rightTip;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean deleted) {
        this.deleted = deleted;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
